﻿<%@ Page Title="" Language="C#" MasterPageFile="~/DeveloperSite.Master" AutoEventWireup="true" 
        CodeBehind="Approved_Project_Reports.aspx.cs" Inherits="UNDP_Projects.CO.Approved_Project_Reports" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<asp:EntityDataSource ID="ApprovedProjectsDataSource" runat="server" 
        ConnectionString="name=UNDPEntities" DefaultContainerName="UNDPEntities" 
        EnableFlattening="False" EntitySetName="project_reports"
        Include="year, report_period, project" 
        AutoGenerateWhereClause="True" EnableDelete="True" EnableInsert="True" 
        EnableUpdate="True">
        <WhereParameters>
            <asp:Parameter DefaultValue="true" Name="approved" Type="Boolean" />
        </WhereParameters>
    </asp:EntityDataSource>

    <asp:Label ID="Error" runat="server" Text="" Visible="false"></asp:Label>
    <asp:Label ID="ContextLabel" runat="server" Text="COUNTRY OFFICE APPROVAL" CssClass="ContentHead"></asp:Label>

    <% if (User.IsInRole("Administrator"))
       { %>
       <asp:GridView ID="ApprovedProjectsGridView" runat="server" 
            DataSourceID="ApprovedProjectsDataSource" AutoGenerateColumns="false" 
            CssClass="NewGrid" ShowFooter="true" 
            DataKeyNames="project_id, year_id, report_period_id" 
            OnRowCommand="ApprovedProjectsGridView_RowCommand">
            <AlternatingRowStyle CssClass="NewGridAlt" />
            <FooterStyle CssClass="NewGridFooter" />
            <Columns>
                <asp:TemplateField HeaderText="YEAR">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("year.year1") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="REPORT PERIOD">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("report_period.report_period1") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="PROJECT" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="400px">
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Eval("project.project1") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:ButtonField ButtonType="Button" CommandName="view" Text="Access" HeaderText="DATA ENTRY" />
                <asp:ButtonField ButtonType="Button" CommandName="pdf" Text="PDF" HeaderText="DOWNLOAD" />
            </Columns>
        </asp:GridView>
            
    <% }
       else
       { %>
        <asp:GridView ID="GridView1" runat="server" 
            DataSourceID="ApprovedProjectsDataSource" AutoGenerateColumns="False" 
            CssClass="NewGrid" ShowFooter="True" 
            DataKeyNames="project_id,year_id,report_period_id" 
            OnRowCommand="ApprovedProjectsGridView_RowCommand">
            <AlternatingRowStyle CssClass="NewGridAlt" />
            <FooterStyle CssClass="NewGridFooter" />
            <Columns>
                <asp:TemplateField HeaderText="YEAR">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("year.year1") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="REPORT PERIOD">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("report_period.report_period1") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="PROJECT" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="400px">
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Eval("project.project1") %>'></asp:Label>
                    </ItemTemplate>

                <ItemStyle HorizontalAlign="Left" Width="400px"></ItemStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="DATA ENTRY" ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="Button1" runat="server" CausesValidation="false" 
                            CommandName="view" Text="Access" Enabled="false" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="DOWNLOAD" ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="Button2" runat="server" CausesValidation="false" 
                            CommandName="pdf" Text="PDF" Enabled="false" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    <% } %>
    <%--<p>
        <asp:Label ID="ProjectLabel" runat="server" Text=""></asp:Label><br />
        <asp:Label ID="ReportPeriodLabel" runat="server" Text=""></asp:Label><br />
        <asp:Label ID="YearLabel" runat="server" Text=""></asp:Label>
    </p>--%>

</asp:Content>
